﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService
Partial Class FrontEnd_Control_ToolLikeCmt_BoxShare
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            If Page.RouteData.Values("Id") <> "" Then
                hidId.Value = Page.RouteData.Values("Id")
                If hidId.Value = "" Then
                    hidId.Value = 0
                End If
            End If
            BindMenu()
        End If
    End Sub
    Protected Sub BindMenu()
        Using data As New VSEntities
            'ParenId = 0 Menu cha
            'MenuPosition = 1 hien thi tren menu
            Dim d = (From p In data.Contents Where p.Id = hidId.Value Select p).FirstOrDefault

            Dim Url = MainDomain & "m/" & d.QueryString & "-" & d.Id & ".html"
            'share facebook
            ltrShareFacebook.Text = "<a href='javascript:void(0);' class='badge-facebook-share badge-facebook-bot-share badge-evt badge-track btn-share facebook' data-evt='Facebook-Share,PostClicked," & Url & "' data-share='" & Url & "'>Share on Facebook</a>"
            'share twitter
            ltrShareTwitter.Text = "<a href='javascript:void(0);' class='badge-twitter-share badge-twitter-bot-share badge-evt badge-track btn-share twitter' data-evt='Twitter-Share,ListClicked," & Url & "' data-title = '" & d.Title & "' data-share='" & Url & "'>Share on Twitter</a>"

        End Using
    End Sub
End Class
